<?php
//重置用户抽奖
ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

$platform = $argv[1];

$unqid = $argv[2];

if (!in_array($platform, [0, 1])) {
    echo "平台参数错误";
    exit;
}

if (empty($unqid)) {
    echo "请输入身份id，uid 或 openid";
    exit;
}

$uid = $platform == 1 ? 0 : $unqid;

$openid = $platform == 1 ? $unqid : '';

\Biz\model\MijiaSmartKitchen\MiJiaSmartKitchenUserLottery::delete(
    [
        'uid' => $uid,
        'third_id' => $openid,
        'lottery_platform' => $platform
    ]);

var_dump(\Biz\model\MijiaSmartKitchen\MiJiaSmartKitchenUserLottery::log());

\Biz\model\MijiaSmartKitchen\MijiaSmartKitchenWinningRecord::delete(
    [
        'uid' => $uid,
        'third_id' => $openid,
        'lottery_platform' => $platform
    ]
);

var_dump(\Biz\model\MijiaSmartKitchen\MiJiaSmartKitchenUserLottery::log());

\Biz\cache\lottery\MijiaSmartKitchenLottery::removeUserOutWinning($unqid);

